<template>
  <a-modal
    v-model="show"
    :centered="true"
    :keyboard="false"
    :footer="null"
    :width="1050"
    @cancel="handleCancleClick"
    title="停用">

    <a-form>
      <a-row>终端基础信息</a-row>
      <a-row>
        <a-col :md="12" :sm="24">
          <a-form-item label="商户编码"
                       v-bind="formItemLayout">
            <a-input v-model="infoStopUseData.mchntNo" :disabled="true"/>
          </a-form-item>
        </a-col>
        <a-col :md="12" :sm="24">
          <a-form-item label='终端打印商户名称'
                       v-bind="formItemLayout">
            <a-input v-model="infoStopUseData.termPrintMerName" :disabled="true"/>
          </a-form-item>
        </a-col>
      </a-row>
      <a-row>
        <a-col :md="12" :sm="24">
          <a-form-item label="终端编号"
                       v-bind="formItemLayout">
            <a-input v-model="infoStopUseData.termNo" :disabled="true"/>
          </a-form-item>
        </a-col>
        <a-col :md="12" :sm="24">
          <a-form-item label='收单机构代码'
                       v-bind="formItemLayout">
            <a-input v-model="infoStopUseData.posInstCd" :disabled="true"/>
          </a-form-item>
        </a-col>
      </a-row>
      <a-row>
        <a-col :md="12" :sm="24">
          <a-form-item label='终端类型'
                       v-bind="formItemLayout">
            <a-input v-model="infoStopUseData.termType" :disabled="true"/>
          </a-form-item>
        </a-col>
        <a-col :md="12" :sm="24">
          <a-form-item label="终端厂商"
                       v-bind="formItemLayout">
            <a-input v-model="infoStopUseData.brandCode" :disabled="true"/>
          </a-form-item>
        </a-col>
      </a-row>
      <a-row>
        <a-col :md="12" :sm="24">
          <a-form-item label='终端型号'
                       v-bind="formItemLayout">
            <a-input v-model="infoStopUseData.modelCode" :disabled="true"/>
          </a-form-item>
        </a-col>
        <a-col :md="12" :sm="24">
          <a-form-item label='维护开始时间'
                       v-bind="formItemLayout">
            <a-input v-model="infoStopUseData.startTime" :disabled="true"/>
          </a-form-item>
        </a-col>
      </a-row>
      <a-row>终端承包商信息</a-row>
      <a-row>
        <a-col :md="12" :sm="24">
          <a-form-item label="终端交易发起方式"
                       v-bind="formItemLayout">
            <a-radio-group name="radioGroup" v-model="infoStopUseData.termTxnStarWay" :disabled="true">
              <a-radio :value="'10'">现场消费</a-radio>
              <a-radio :value="'01'">自助支付</a-radio>
            </a-radio-group>
          </a-form-item>
        </a-col>
      </a-row>
      <a-row>
        <a-col :md="12" :sm="24">
          <a-form-item label="条码终端设备类型"
                       v-bind="formItemLayout">
            <a-input v-model="infoStopUseData.termDevcTp" :disabled="true"/>
          </a-form-item>
        </a-col>
      </a-row>
      <a-row>
        <a-col :md="24" :sm="24">
          <a-form-item label="布放实体店地域"
                       :label-col="{span: 4}"
                       :wrapper-col="{span: 20}">
            <a-select
              placeholder="省"
              style="width: 260px"
              v-model="infoStopUseData.termAddrPrvnc"
              :disabled="true"/>
            <a-select
              placeholder="市"
              style="width: 260px"
              v-model="infoStopUseData.termAddrCity"
              :disabled="true"/>
            <a-select
              placeholder="区"
              style="width: 260px"
              v-model="infoStopUseData.termAddrArea"
              :disabled="true"/>
          </a-form-item>
        </a-col>
      </a-row>
      <a-row>
        <a-col :md="12" :sm="24">
          <a-form-item label='布放实体店详细地址'
                       v-bind="formItemLayout">
            <a-textarea v-model="infoStopUseData.shopAttr" :disabled="true"/>
          </a-form-item>
        </a-col>
      </a-row>
      <a-row>
        <a-col :md="12" :sm="24">
          <a-form-item label="布放实体店时间"
                       v-bind="formItemLayout">
            <a-input v-model="infoStopUseData.shoptime" :disabled="true"/>
          </a-form-item>
        </a-col>
        <a-col :md="12" :sm="24">
          <a-form-item label='S/N'
                       v-bind="formItemLayout">
            <a-input v-model="infoStopUseData.sn" :disabled="true"/>
          </a-form-item>
        </a-col>
      </a-row>
      <a-row>
        <a-col :md="12" :sm="24">
          <a-form-item label='终端联系人'
                       v-bind="formItemLayout">
            <a-input v-model="infoStopUseData.contactName" :disabled="true"/>
          </a-form-item>
        </a-col>
        <a-col :md="12" :sm="24">
          <a-form-item label="终端联系电话"
                       v-bind="formItemLayout">
            <a-input v-model="infoStopUseData.contactPhone" :disabled="true"/>
          </a-form-item>
        </a-col>
      </a-row>
      <a-row>
        <a-col :md="12" :sm="24">
          <a-form-item label='经度'
                       v-bind="formItemLayout">
            <a-input v-model="infoStopUseData.longitude" :disabled="true"/>
          </a-form-item>
        </a-col>
        <a-col :md="12" :sm="24">
          <a-form-item label='纬度'
                       v-bind="formItemLayout">
            <a-input v-model="infoStopUseData.latitude" :disabled="true"/>
          </a-form-item>
        </a-col>
      </a-row>
      <a-row>
        <a-col :md="12" :sm="24">
          <a-form-item label='有效半径(单位：千米)'
                       v-bind="formItemLayout">
            <a-input v-model="infoStopUseData.effectiveRadius" :disabled="true"/>
          </a-form-item>
        </a-col>
      </a-row>
      <br>
    </a-form>
    <div class="drawer-bootom-button">
      <a-popconfirm title="确定放弃编辑？" @confirm="handleCancleClick" okText="确定" cancelText="取消">
        <a-button style="margin-right: .8rem">取消</a-button>
      </a-popconfirm>
      <a-button @click="submitData" type="primary" :loading="loading">提交</a-button>
    </div>
  </a-modal>
</template>

<script>
  const formItemLayout = {
    labelCol: {span: 8},
    wrapperCol: {span: 16}
  }
  export default {

    name: 'infoStopUse',
    data() {
      return {
        formItemLayout,
        loading: false
      }
    },
    props: {
      infoStopUseVisiable: {
        require: true,
        default: false
      },
      infoStopUseData: {
        require: true
      }
    },
    computed: {
      show: {
        get: function () {
          return this.infoStopUseVisiable
        },
        set: function () {
        }
      }
    },

    methods: {
      handleCancleClick() {
        this.$emit('close')
      },

      reset() {
        this.loading = false
      },

      submitData() {
        this.loading = false
        let param = {}
        param.id = this.infoStopUseData.id
        param.optFlag = 'stop'
        param.instId = this.infoStopUseData.instId
        console.log(param)
        this.$put('info/infoStatusChange', param).then((r) => {
          this.reset()
          this.$emit('success')
        }).catch(() => {
          this.loading = false
        })
      },

    }
  }
</script>

